package myException.myRestfulGolbalException;


import org.springframework.util.StringUtils;

public enum CommonResultMsg {
    SERVER_BUSY(101, "服务器繁忙"),
    GATEWAY_SERVER_BUSY(102, "网关服务繁忙"),
    UNAUTHENTICATED(103, "请求未经认证"),
    FORBIDDEN(104, "请求未经授权"),
    REQUEST_METHOD_NOT_SUPPORTED(105, "请求类型暂不支持"),
    TOKEN_EXPIRED(106, "token已过期"),
    TOKEN_ILLEGAL(107, "token无效"),
    REQUEST_PARAMS_ILLEGAL(108, "请求参数错误"),
    RESOURCE_NOT_FOUND(109, "请求资源没有找到"),
    SERVICE_NOT_AVAILABLE(110, "服务暂不可用"),

    MESSAGE_TYPE_NO_CORRECT(111, "短信类型不正确"),
    CAPTCHA_IS_VALID(112, "请勿重复发送请求，验证码1分钟有效"),
    CAPTCHA_IS_SENT(113, "验证码已经发送，请注意查收"),
    CAPTCHA_SENT_FAIL(114, "发送验证码失败,请重新发送"),
    CAPTCHA_NOT_CORRECT(114, "验证码不正确"),
    MESSAGE_SENT_SUCCESS(200, "催办成功"),
    SUCCESS(200, "操作成功"),
    EXPORT_FAIL(201, "导出失败"),

    USER_USERNAME_PASSWORD_FORMAT_ERROR(206, "密码格式不正确"),
    IMPORT_ERROR(207, "导入数据异常"),
    IMPORT_DATA_EMPTY_ERROR(208, "导入数据为空");

    private long code;
    private String message;

    private CommonResultMsg(long code, String message) {
        this.code = code;
        this.message = message;
    }

    public long code() {
        return this.code;
    }

//    @Override
//    public String message() {
//        String msg = MessageUtils.get(this.getClass().getSimpleName() + "_" + this.name());
//        if (StringUtils.hasText(msg)) {
//            return msg;
//        }
//        return this.message;
//    }

}
